from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope import snapshot_download

# # 模型下载地址
model_dir = snapshot_download("iic/nlp_structbert_sentiment-classification_chinese-base")
print(model_dir)

# # 加载模型
semantic_cls = pipeline(Tasks.text_classification, model=model_dir)

# # 输入文本
text = "这个AGV走路好灵活，速度又快"

# # 调用模型进行自然语言理解
result = semantic_cls(text)

# # 输出结果
print(result)
print(result["labels"][0], result["scores"][0])

